package bootstrap

import (
	"database/sql"
	"gitee.com/goblog2/pkg"
	"github.com/go-sql-driver/mysql"
)

func ConnectDB() *sql.DB {
	config := mysql.Config{
		User:   "root",
		Passwd: "secret",
		Net:    "tcp",
		Addr:   "127.0.0.1:3306",
		DBName: "goblog",
	}
	db, _ := sql.Open("mysql", config.FormatDSN())
	pkg.CheckError(db.Ping())
	return db
}
